package cn.sinjet.model.carsystem;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.annotation.SuppressLint;
import android.util.Log;
import cn.sinjet.entity.PID;

public class OBDData {
	boolean isFastDetectionShowAll = false;
	private List<String> mDetectedDataList = new ArrayList<String>();
	private List<PID> mPidDataList = new ArrayList<PID>();
	@SuppressLint("UseSparseArrays") private HashMap<Integer, XJPID> mPidMap = new HashMap<Integer, XJPID>();
	@SuppressLint("UseSparseArrays") public HashMap<Integer, XJPIDDATA> mSupportPIDMap = new HashMap<Integer, XJPIDDATA>();
	
    public OBDData(){
    	initPidMap();
		initPidDataMap();
    }
    
    public List<PID> getPidDataList(){
    	return mPidDataList;
    }
    private void initPidMap(){
    	mPidMap.clear();

		XJPID pid = new XJPID();
		pid.number = 1;
		pid.PID = 0x01;

		pid.discription = "故障码数量";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 2;
		pid.PID = 0x01;

		pid.discription = "MIL状态";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 3;
		pid.PID = 0x01;

		pid.discription = "是否支持失火监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 4;
		pid.PID = 0x01;

		pid.discription = "是否支持燃油系统监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 5;
		pid.PID = 0x01;

		pid.discription = "是否支持组件系统监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 6;
		pid.PID = 0x01;

		pid.discription = "失火监测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 7;
		pid.PID = 0x01;

		pid.discription = "燃油系统检测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 8;
		pid.PID = 0x01;

		pid.discription = "组件系统监测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 9;
		pid.PID = 0x01;

		pid.discription = "是否支持催化剂监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 10;
		pid.PID = 0x01;

		pid.discription = "是否支持催化剂加热监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 11;
		pid.PID = 0x01;

		pid.discription = "是否支持蒸发系统监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 12;
		pid.PID = 0x01;

		pid.discription = "是否支持二次空气系统监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 13;
		pid.PID = 0x01;

		pid.discription = "是否支持空调系统制冷监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 14;
		pid.PID = 0x01;

		pid.discription = "是否支持氧传感器监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 15;
		pid.PID = 0x01;

		pid.discription = "是否支持氧传感器加热监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 16;
		pid.PID = 0x01;

		pid.discription = "是否支持EGR系统监测";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 17;
		pid.PID = 0x01;

		pid.discription = "催化剂监测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 18;
		pid.PID = 0x01;

		pid.discription = "催化剂加热监测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 19;
		pid.PID = 0x01;

		pid.discription = "蒸发系统监测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 20;
		pid.PID = 0x01;

		pid.discription = "二次空气系统监测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 21;
		pid.PID = 0x01;

		pid.discription = "空气系统制冷监测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 22;
		pid.PID = 0x01;

		pid.discription = "氧传感器监测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 23;
		pid.PID = 0x01;

		pid.discription = "氧传感器加热监测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 24;
		pid.PID = 0x01;

		pid.discription = "EGR系统监测是否完成";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 25;
		pid.PID = 0x03;

		pid.discription = "燃油系统1状态";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 26;
		pid.PID = 0x03;

		pid.discription = "燃油系统2状态";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 27;
		pid.PID = 0x04;

		pid.discription = "计算负荷值";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 28;
		pid.PID = 0x05;

		pid.discription = "发动机冷却液温度";

		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 29;
		pid.PID = 0x06;

		pid.discription = "短时燃油修正-Bank1";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 30;
		pid.PID = 0x07;

		pid.discription = "长时燃油修正-Bank1";

		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 31;
		pid.PID = 0x08;

		pid.discription = "短期燃油修正-Bank2";

		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 32;
		pid.PID = 0x09;

		pid.discription = "长时燃油修正-Bank2";

		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 33;
		pid.PID = 0x0A;

		pid.discription = "燃油压力";

		pid.unit = "Kpa";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 34;
		pid.PID = 0x0B;

		pid.discription = "进气歧管绝对压力";

		pid.unit = "Kpa";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 35;
		pid.PID = 0x0C;

		pid.discription = "发动机转数";

		pid.unit = "rpm";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 36;
		pid.PID = 0x0D;

		pid.discription = "车速";

		pid.unit = "Km/h";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 37;
		pid.PID = 0x0E;

		pid.discription = "点火正时提前角";

		pid.unit = "度";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 38;
		pid.PID = 0x0F;

		pid.discription = "进气温度";

		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 39;
		pid.PID = 0x10;

		pid.discription = "空气流量";

		pid.unit = "Grams/Sec";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 40;
		pid.PID = 0x11;

		pid.discription = "节气门绝对位置";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 41;
		pid.PID = 0x14;

		pid.discription = "Bank1传感器1氧传感器输出电压";

		pid.unit = "V";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 42;
		pid.PID = 0x14;

		pid.discription = "Bank1传感器1短时燃油修正";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 43;
		pid.PID = 0x15;

		pid.discription = "Bank1传感器2氧传感器输出电压";

		pid.unit = "V";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 44;
		pid.PID = 0x15;

		pid.discription = "Bank1传感器2短时燃油修正";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 45;
		pid.PID = 0x16;

		pid.discription = "Bank1传感器3氧传感器输出电压";

		pid.unit = "V";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 46;
		pid.PID = 0x16;

		pid.discription = "Bank1传感器3短时燃油修正";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 47;
		pid.PID = 0x17;

		pid.discription = "Bank1传感器4氧传感器输出电压";

		pid.unit = "V";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 48;
		pid.PID = 0x17;

		pid.discription = "Bank1传感器4短时燃油修正";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 49;
		pid.PID = 0x18;

		pid.discription = "Bank2传感器1氧传感器输出电压";

		pid.unit = "V";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 50;
		pid.PID = 0x18;

		pid.discription = "Bank2传感器1短时燃油修正";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 51;
		pid.PID = 0x19;

		pid.discription = "Bank2传感器2氧传感器输出电压";

		pid.unit = "V";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 52;
		pid.PID = 0x19;

		pid.discription = "Bank2传感器2短时燃油修正";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 53;
		pid.PID = 0x1A;

		pid.discription = "Bank2传感器3氧传感器输出电压";

		pid.unit = "V";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 54;
		pid.PID = 0x1A;

		pid.discription = "Bank2传感器3短时燃油修正";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 55;
		pid.PID = 0x1B;

		pid.discription = "Bank2传感器4氧传感器输出电压";

		pid.unit = "V";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 56;
		pid.PID = 0x1B;

		pid.discription = "Bank2传感器4短时燃油修正";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 57;
		pid.PID = 0x1F;

		pid.discription = "发动机启动后运行的时间";

		pid.unit = "S";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 58;
		pid.PID = 0x21;

		pid.discription = "MIL激活状态下的行驶里程";

		pid.unit = "KM";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 59;
		pid.PID = 0x22;

		pid.discription = "燃油导轨压力/相对于歧管真空压力";

		pid.unit = "Kpa";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 60;
		pid.PID = 0x23;

		pid.discription = "燃油导轨压力";

		pid.unit = "Kpa";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 61;
		pid.PID = 0x2C;

		pid.discription = "指令的EGR";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 62;
		pid.PID = 0x2D;

		pid.discription = "返回EGR错误";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 63;
		pid.PID = 0x2E;

		pid.discription = "燃油蒸发排放控制指令";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 64;
		pid.PID = 0x2F;

		pid.discription = "剩余油量";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 65;
		pid.PID = 0x30;

		pid.discription = "故障码清除后暖机次数";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 66;
		pid.PID = 0x31;

		pid.discription = "故障码清除后行驶里程";

		pid.unit = "KM";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 67;
		pid.PID = 0x32;

		pid.discription = "蒸汽系统的蒸发压力";

		pid.unit = "Pa";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 68;
		pid.PID = 0x33;

		pid.discription = "气压";

		pid.unit = "Kpa";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 69;
		pid.PID = 0x34;

		pid.discription = "Bank1氧传感器1当量比";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 70;
		pid.PID = 0x34;

		pid.discription = "Bank1氧传感器1电流";

		pid.unit = "Ma";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 71;
		pid.PID = 0x35;

		pid.discription = "Bank1氧传感器2当量比";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 72;
		pid.PID = 0x35;

		pid.discription = "Bank1氧传感器2电流";

		pid.unit = "Ma";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 73;
		pid.PID = 0x36;

		pid.discription = "Bank1氧传感器3当量比";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 74;
		pid.PID = 0x36;

		pid.discription = "Bank1氧传感器3电流";

		pid.unit = "Ma";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 75;
		pid.PID = 0x37;

		pid.discription = "Bank1氧传感器4当量比";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 76;
		pid.PID = 0x37;

		pid.discription = "Bank1氧传感器4电流";

		pid.unit = "Ma";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 77;
		pid.PID = 0x38;

		pid.discription = "Bank2氧传感器1当量比";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 78;
		pid.PID = 0x38;

		pid.discription = "Bank2氧传感器1电流";

		pid.unit = "Ma";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 79;
		pid.PID = 0x39;

		pid.discription = "Bank2氧传感器2当量比";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 80;
		pid.PID = 0x39;

		pid.discription = "Bank2氧传感器2电流";

		pid.unit = "Ma";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 81;
		pid.PID = 0x3A;

		pid.discription = "Bank2氧传感器3当量比";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 82;
		pid.PID = 0x3A;

		pid.discription = "Bank2氧传感器3电流";

		pid.unit = "Ma";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 83;
		pid.PID = 0x3B;

		pid.discription = "Bank2氧传感器4当量比";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 84;
		pid.PID = 0x3B;

		pid.discription = "Bank2氧传感器4电流";

		pid.unit = "Ma";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 85;
		pid.PID = 0x3C;

		pid.discription = "催化剂温度Bank1传感器1";

		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 86;
		pid.PID = 0x3D;

		pid.discription = "催化剂温度Bank2传感器1";

		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 87;
		pid.PID = 0x3E;

		pid.discription = "催化剂温度Bank1传感器2";

		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 88;
		pid.PID = 0x3F;

		pid.discription = "催化剂温度Bank2传感器2";

		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 89;
		pid.PID = 0x42;

		pid.discription = "控制模块电压";

		pid.unit = "V";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 90;
		pid.PID = 0x43;

		pid.discription = "绝对负荷值";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 91;
		pid.PID = 0x44;

		pid.discription = "当量比控制指令";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 92;
		pid.PID = 0x45;

		pid.discription = "节气门相对位置";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 93;
		pid.PID = 0x46;

		pid.discription = "环境温度";

		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 94;
		pid.PID = 0x47;

		pid.discription = "节气门绝对位置B";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 95;
		pid.PID = 0x48;

		pid.discription = "节气门绝对位置C";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 96;
		pid.PID = 0x49;

		pid.discription = "加速踏板位置D";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 97;
		pid.PID = 0x4A;

		pid.discription = "加速踏板位置E";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 98;
		pid.PID = 0x4B;

		pid.discription = "加速踏板位置F";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 99;
		pid.PID = 0x4C;

		pid.discription = "节气门执行器控制指令";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 100;
		pid.PID = 0x4D;

		pid.discription = "MIL灯亮后发动机运行时间";

		pid.unit = "minutes";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 101;
		pid.PID = 0x4E;

		pid.discription = "故障码清空后发动机运行时间";
		pid.unit = "minutes";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 102;
		pid.PID = 0x50;

		pid.discription = "空气质量传感器中空气流速最大值";

		pid.unit = "g/s";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 103;
		pid.PID = 0x53;

		pid.discription = "燃油蒸发排放控制系统蒸汽压力绝对值";

		pid.unit = "Kpa";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 104;
		pid.PID = 0x54;

		pid.discription = "燃油蒸发排放控制系统蒸汽压力";

		pid.unit = "pa";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 105;
		pid.PID = 0x55;

		pid.discription = "第二氧传感器短时燃油修正Bank1";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 106;
		pid.PID = 0x55;

		pid.discription = "第二氧传感器短时燃油修正Bank3";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 107;
		pid.PID = 0x56;

		pid.discription = "第二氧传感器长时燃油修正Bank1";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 108;
		pid.PID = 0x56;

		pid.discription = "第二氧传感器长时燃油修正Bank3";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 109;
		pid.PID = 0x57;

		pid.discription = "第二氧传感器短时燃油修正Bank2";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 110;
		pid.PID = 0x57;

		pid.discription = "第二氧传感器短时燃油修正Bank4";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 111;
		pid.PID = 0x58;

		pid.discription = "第二氧传感器长时燃油修正Bank2";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 112;
		pid.PID = 0x58;

		pid.discription = "第二氧传感器长时燃油修正Bank4";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 113;
		pid.PID = 0x59;

		pid.discription = "燃油导轨压力";

		pid.unit = "Kpa";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 114;
		pid.PID = 0x5A;

		pid.discription = "加速踏板相对位置";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 115;
		pid.PID = 0x5B;

		pid.discription = "混合动力电池包剩余容量";

		pid.unit = "%";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 116;
		pid.PID = 0x5C;

		pid.discription = "发动机润滑油温度";
		pid.unit = "°C";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 117;
		pid.PID = 0x5D;

		pid.discription = "燃油喷射定时";

		mPidMap.put(pid.number, pid);

		pid = new XJPID();
		pid.number = 118;
		pid.PID = 0x5E;

		pid.discription = "发动机燃油消耗率";

		pid.unit = "L/H";

		mPidMap.put(pid.number, pid);
    }
    private void initPidDataMap(){
    	mSupportPIDMap.clear();
		int i = 0;
		for (i = 0; i <= 255; i++) {
			XJPIDDATA t = new XJPIDDATA();
			mSupportPIDMap.put(i, t);
		}
    }
    
    class XJPID {
		public XJPID() {
			number = 0;
			PID = 0;
			unit = "";
			discription = "";
			status = "--|--";
		}

		public int number;
		public int PID;
		public String unit;
		public String discription;
		public String status;
	}

	 class XJPIDDATA {
		public XJPIDDATA() {
			A = 0;
			B = 0;
			C = 0;
			D = 0;
			support = -1;
		}

		public int A;
		public int B;
		public int C;
		public int D;

		public int support;
	}
	 
	 public void handlePid(int from, byte a, byte b, byte c, byte d){
		 int i = 0;
			Log.e("dyt", "start");
			int data = a & 0xFF;
			from = from + 0;
			for (i = 7; i >= 0; i--) {
				int id = from + (7 - i);
				Log.e("dyt", "1 id = " + id);
				XJPIDDATA t = mSupportPIDMap.get(id);
				t.support = ((data & (1 << i)) != 0) ? 1 : 0;
			}

			data = b & 0xFF;
			from = from + 8;
			for (i = 7; i >= 0; i--) {
				int id = from + (7 - i);
				Log.e("dyt", "2 id = " + id);
				XJPIDDATA t = mSupportPIDMap.get(id);
				t.support = ((data & (1 << i)) != 0) ? 1 : 0;
			}

			data = c & 0xFF;
			from = from + 8;
			for (i = 7; i >= 0; i--) {
				int id = from + (7 - i);
				Log.e("dyt", "3 id = " + id);
				XJPIDDATA t = mSupportPIDMap.get(id);
				t.support = ((data & (1 << i)) != 0) ? 1 : 0;
			}

			data = d & 0xFF;
			from = from + 8;
			for (i = 7; i >= 0; i--) {
				int id = from + (7 - i);
				Log.e("dyt", "4 id = " + id);
				XJPIDDATA t = mSupportPIDMap.get(id);
				t.support = ((data & (1 << i)) != 0) ? 1 : 0;
			}
	 }

	public List<String> getDectectedErrObdList() {
		// TODO Auto-generated method stub
		return mDetectedDataList;
	}
	
	
	String m_strBuDingPidIndex25 = "";
	public void showPid(){
		if(mPidDataList == null||mSupportPIDMap ==null||mPidMap==null){
			Log.d("err", "showPid something == null");
			return;
		}
		mPidDataList.clear();

		int i = 0;
		for (i = 1; i <= 118; i++) {
			XJPID pid = mPidMap.get(i);
           if(pid == null){
        	   Log.d("err", "not found in pidMap");
           	return;
           }
			float value = 0;
			XJPIDDATA t = mSupportPIDMap.get(pid.PID);
			if(t == null){
				Log.d("err", "mSupportPIDMap");
				return;
			}
			int A = t.A;
			int B = t.B;
			int C = t.C;
			int D = t.D;
			String status = "";

			if (t.support == 1) {

				switch (pid.number) {
				case 1:
					status = String.format("%d", A & 0x7F);
					break;
				case 2:
					value = (A >> 7) & 1;
					status = (1 == value) ? "ON" : "OFF";
					break;
				case 3:
					value = ((B << 7) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 4:
					value = ((B << 6) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 5:
					value = ((B << 5) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 6:
					value = ((B << 3) >> 7) & 1;
					status = (1 == value) ? "否" : "是";
					break;
				case 7:
					value = ((B << 2) >> 7) & 1;
					status = (1 == value) ? "否" : "是";
					break;
				case 8:
					value = ((B << 1) >> 7) & 1;
					status = (1 == value) ? "否" : "是";
					break;
				case 9:
					value = ((C << 7) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 10:
					value = ((C << 6) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 11:
					value = ((C << 5) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 12:
					value = ((C << 4) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 13:
					value = ((C << 3) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 14:
					value = ((C << 2) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 15:
					value = ((C << 1) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 16:
					value = (C >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 17:
					value = ((D << 7) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 18:
					value = ((D << 6) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 19:
					value = ((D << 5) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 20:
					value = ((D << 4) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 21:
					value = ((D << 3) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 22:
					value = ((D << 2) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 23:
					value = ((D << 1) >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 24:
					value = (D >> 7) & 1;
					status = (1 == value) ? "是" : "否";
					break;
				case 25: {
					int b0 = A & 0x01;
					int b1 = (A & 0x02) >> 1;
					int b2 = (A & 0x04) >> 2;
					int b3 = (A & 0x08) >> 3;
					int b4 = (A & 0x10) >> 4;

					if (1 == b1) {
						status = "闭环";
					} else if (0 == b1) {
						if (1 == b0) {
							status = "开环";
						} else if (0 == b0) {
							if (1 == b2)
								status = "开环控制";
							else if (1 == b3)
								status = "开环失败";
							else if (1 == b4)
								status = "闭环失败";
						}
					}

					m_strBuDingPidIndex25 = status;
				}
					break;
				case 26: {
					int b0 = B & 0x01;
					int b1 = (B & 0x02) >> 1;
					int b2 = (B & 0x04) >> 2;
					int b3 = (B & 0x08) >> 3;
					int b4 = (B & 0x10) >> 4;

					if (1 == b1) {
						status = "闭环";
					} else if (0 == b1) {
						if (1 == b0) {
							status = "开环";
						} else if (0 == b0) {
							if (1 == b2)
								status = "开环控制";
							else if (1 == b3)
								status = "开环失败";
							else if (1 == b4)
								status = "闭环失败";
							else
								status = m_strBuDingPidIndex25;
						}
					}

				}
					break;
				case 27:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 28:
					value = (float) (A - 40.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 29:
					value = (float) ((A - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 30:
					value = (float) ((A - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 31:
					value = (float) ((A - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 32:
					value = (float) ((A - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 33:
					value = (float) (A * 3.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 34:
					value = (float) (A * 1.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 35:
					value = (float) ((A * 256 + B) / 4);
					status = String.format("%d%s", (int) value, pid.unit);
					break;
				case 36:
					value = (float) (A * 1.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 37:
					value = (float) ((A - 128.0) / 2);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 38:
					value = (float) (A - 40.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 39:
					value = (float) ((A * 256.0 + B) / 100);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 40:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 41:
					value = (float) (A / 200.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 42:
					if (B == 0xff)
						status = "传感器未使用";
					else {
						value = (float) ((B - 128) * 100.0 / 128);
						status = String.format("%.1f%s", value, pid.unit);
					}
					break;
				case 43:
					value = (float) (A / 200.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 44:
					if (B == 0xff)
						status = "传感器未使用";
					else {
						value = (float) ((B - 128) * 100.0 / 128);
						status = String.format("%.1f%s", value, pid.unit);
					}
					break;
				case 45:
					value = (float) (A / 200.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 46:
					if (B == 0xff)
						status = "传感器未使用";
					else {
						value = (float) ((B - 128) * 100.0 / 128);
						status = String.format("%.1f%s", value, pid.unit);
					}
					break;
				case 47:
					value = (float) (A / 200.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 48:
					if (B == 0xff)
						status = "传感器未使用";
					else {
						value = (float) ((B - 128) * 100.0 / 128);
						status = String.format("%.1f%s", value, pid.unit);
					}
					break;
				case 49:
					value = (float) (A / 200.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 50:
					if (B == 0xff)
						status = "传感器未使用";
					else {
						value = (float) ((B - 128) * 100.0 / 128);
						status = String.format("%.1f%s", value, pid.unit);
					}
					break;
				case 51:
					value = (float) (A / 200.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 52:
					if (B == 0xff)
						status = "传感器未使用";
					else {
						value = (float) ((B - 128) * 100.0 / 128);
						status = String.format("%.1f%s", value, pid.unit);
					}
					break;
				case 53:
					value = (float) (A / 200.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 54:
					if (B == 0xff)
						status = "传感器未使用";
					else {
						value = (float) ((B - 128) * 100.0 / 128);
						status = String.format("%.1f%s", value, pid.unit);
					}
					break;
				case 55:
					value = (float) (A / 200.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 56:
					if (B == 0xff)
						status = "传感器未使用";
					else {
						value = (float) ((B - 128) * 100.0 / 128);
						status = String.format("%.1f%s", value, pid.unit);
					}
					break;
				case 57:
					value = (float) (A * 256.0 + B);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 58:
					value = (float) (A * 256.0 + B);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 59:
					value = (float) (((A * 256) + B) * 0.079);
					status = String.format("%.3f%s", value, pid.unit);
					break;
				case 60:
					value = (float) (((A * 256.0) + B) * 10);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 61:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 62:
					value = (float) ((A - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 63:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 64:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 65:
					value = (float) (A * 1.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 66:
					value = (float) (A * 256.0 + B);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 67:
					value = (float) (((char) A * 256.0 + (char) B) / 4);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 68:
					value = (float) (A * 1.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 69:
					value = (float) ((A * 256.0 + B) / 32768);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 70:
					value = (float) ((C * 256.0 + D) / 256 - 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 71:
					value = (float) ((A * 256.0 + B) / 32768);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 72:
					value = (float) ((C * 256.0 + D) / 256 - 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 73:
					value = (float) ((A * 256.0 + B) / 32768);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 74:
					value = (float) ((C * 256.0 + D) / 256 - 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 75:
					value = (float) ((A * 256.0 + B) / 32768);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 76:
					value = (float) ((C * 256.0 + D) / 256 - 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 77:
					value = (float) ((A * 256.0 + B) / 32768);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 78:
					value = (float) ((C * 256.0 + D) / 256 - 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 79:
					value = (float) ((A * 256.0 + B) / 3276);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 80:
					value = (float) ((C * 256.0 + D) / 256 - 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 81:
					value = (float) ((A * 256.0 + B) / 32768);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 82:
					value = (float) ((C * 256.0 + D) / 256 - 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 83:
					value = (float) ((A * 256.0 + B) / 32768);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 84:
					value = (float) ((C * 256.0 + D) / 256 - 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 85:
					value = (float) ((A * 256.0 + B) / 10 - 40);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 86:
					value = (float) ((A * 256.0 + B) / 10 - 40);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 87:
					value = (float) ((A * 256.0 + B) / 10 - 40);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 88:
					value = (float) ((A * 256.0 + B) / 10 - 40);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 89:
					value = (float) ((A * 256.0 + B) / 1000);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 90:
					value = (float) ((A * 256.0 + B) * 100 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 91:
					value = (float) ((A * 256.0 + B) / 32768);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 92:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 93:
					value = (float) (A - 40.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 94:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 95:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 96:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 97:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 98:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 99:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 100:
					value = (float) (A * 256.0 + B);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 101:
					value = (float) (A * 256.0 + B);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 102:
					value = (float) (A * 10.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 103:
					value = (float) ((A * 256.0 + B) / 200);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 104:
					value = (float) ((A * 256.0 + B) - 32767);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 105:
					value = (float) ((A - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 106:
					value = (float) ((B - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 107:
					value = (float) ((A - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 108:
					value = (float) ((B - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 109:
					value = (float) ((A - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 110:
					value = (float) ((B - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 111:
					value = (float) ((A - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 112:
					value = (float) ((B - 128) * 100.0 / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 113:
					value = (float) ((A * 256.0 + B) * 10);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 114:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 115:
					value = (float) (A * 100.0 / 255);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 116:
					value = (float) (A - 40.0);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 117:
					value = (float) (((A * 256.0 + B) - 26880) / 128);
					status = String.format("%.1f%s", value, pid.unit);
					break;
				case 118:
					value = (float) ((A * 256.0 + B) * 0.05);
					status = String.format("%.2f%s", value, pid.unit);
					break;
				default:
					status = "未知";
					break;
				}
			} else if (t.support == 0)
				status = "不支持";
			else if (t.support == -1)
				status = "--|--";

			pid.status = status;

			if (isFastDetectionShowAll) {
//			if(true){
				PID ps = new PID();
				ps.strName = String
						.format("%d %s", pid.number, pid.discription);
				ps.strValue = pid.status;
				mPidDataList.add(ps);
			} else {
				if (t.support == 1) {
					PID ps = new PID();
					ps.strName = String.format("%d %s", pid.number,
							pid.discription);
					ps.strValue = pid.status;
					mPidDataList.add(ps);
//					Log.d("err", "mPidDataList add!");
				}
			}
		}
	}

	public boolean isShowAll() {
		// TODO Auto-generated method stub
		return isFastDetectionShowAll;
	}
	public void onClkShowAll(){
		isFastDetectionShowAll = !isFastDetectionShowAll;
		
	}
}
